module Pages.ProblemSummary(problemSummary) where

import State.Database

import Text.Blaze.Html5 (h2, toHtml, Html)
import Prelude
import Pages.Tables

-- | Produces a summary table of all the given problems
problemSummary :: [ProblemInfo] -> Html
problemSummary problems = do
        h2 $ toHtml "Available problems:"
        renderTable columns problems
        where
            programLangCell = show . programLanguage
            columns = [("Problem name", problemName),
                     ("Reference solution language", programLangCell . referenceSolution),
                     ("Test validation language", programLangCell . testValidator)]
